var generator = require('../generator/generator');
var log = require('../model/log');

exports.selectLog = function(req, res, connection){
	var itemId = req.query.id;
	var type = req.query.type;
	console.log('itemId,type',itemId+'----'+type);

	log.selectItemLog(connection, itemId, type, function(rows){
		res.send(rows);
	});
};

exports.selectLogById = function(req, res, connection){
	var logId = req.params['id'];
	console.log('logId',logId);

	log.selectLog(connection, logId,function(rows){
		if(rows != null) {
			rows[0].content=JSON.parse(rows[0].content);
		}
		res.send(rows[0]);
	});
};